<template>
  <div class="b">
      i am {{name}},我今年{{age}}了,性别：{{getSex}}
      <input type="text" v-model="user"/>
      <button @click="setName({name:user})">修改仓库中的name</button>
      <button @click="setAge({age:20})">修改仓库中的age</button>
  </div>
</template>
<script>

import {mapState,mapMutations,mapGetters} from 'vuex'

export default {
    data(){
      return{
        user:''
      }
    },
    computed:{
      ...mapState(['name','age']),
      ...mapGetters(['getSex'])
    },
    methods:{
      ...mapMutations(['setName','setAge']),
    }

}
</script>